<?php

/**
 * calendrier_planning form base class.
 *
 * @method calendrier_planning getObject() Returns the current form's model object
 *
 * @package    gesp
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class Basecalendrier_planningForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'calpln_id'          => new sfWidgetFormInputHidden(),
      'calpln_prj_id'      => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('projet'), 'add_empty' => false)),
      'calpln_date'        => new sfWidgetFormDate(),
      'calpln_heure_debut' => new sfWidgetFormTime(),
      'calpln_heure_fin'   => new sfWidgetFormTime(),
      'calpln_libelle'     => new sfWidgetFormInputText(),
      'calpln_description' => new sfWidgetFormTextarea(),
      'calpln_freq'        => new sfWidgetFormInputText(),
      'calpln_jour'        => new sfWidgetFormInputText(),
      'calpln_actif'       => new sfWidgetFormInputCheckbox(),
      'calpln_date_maj'    => new sfWidgetFormDate(),
    ));

    $this->setValidators(array(
      'calpln_id'          => new sfValidatorChoice(array('choices' => array($this->getObject()->get('calpln_id')), 'empty_value' => $this->getObject()->get('calpln_id'), 'required' => false)),
      'calpln_prj_id'      => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('projet'))),
      'calpln_date'        => new sfValidatorDate(array('required' => false)),
      'calpln_heure_debut' => new sfValidatorTime(array('required' => false)),
      'calpln_heure_fin'   => new sfValidatorTime(array('required' => false)),
      'calpln_libelle'     => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'calpln_description' => new sfValidatorString(array('max_length' => 1024, 'required' => false)),
      'calpln_freq'        => new sfValidatorString(array('max_length' => 1)),
      'calpln_jour'        => new sfValidatorInteger(),
      'calpln_actif'       => new sfValidatorBoolean(array('required' => false)),
      'calpln_date_maj'    => new sfValidatorDate(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('calendrier_planning[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'calendrier_planning';
  }

}
